package com.powernode.driver.controller;

import com.powernode.common.result.Result;
import com.powernode.driver.service.OcrService;
import com.powernode.model.vo.driver.IdCardOcrVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 腾讯云识别接口
 */
@Slf4j
@Tag(name = "腾讯云识别接口管理")
@RestController
@RequestMapping(value="/ocr")
@SuppressWarnings({"unchecked", "rawtypes"})
public class OcrController {
    @Resource
    private OcrService ocrService;

    /**
     * 身份证识别并上传
     *
     * @param file 上传的身份证图片文件
     * @return 身份证识别结果信息
     */
    @Operation(summary = "身份证识别并上传")
    @PostMapping("/idCardOcr")
    public Result<IdCardOcrVo> uploadIdCardOcr(@RequestPart("file") MultipartFile file) {
        return Result.ok(ocrService.idCardOcr(file));
    }
}

